UNPKG

ccdash

Version:

Claude Code Dashboard - A comprehensive monitoring dashboard for Claude Code

1 lines 13.7 kB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[747],{4964:(e,s,t)=>{"use strict";t.d(s,{Xi:()=>d,av:()=>o,j7:()=>i,tU:()=>c});var a=t(5155),l=t(2115),r=t(704),n=t(3999);let c=r.bL,i=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)(r.B8,{ref:s,className:(0,n.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...l})});i.displayName=r.B8.displayName;let d=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)(r.l9,{ref:s,className:(0,n.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...l})});d.displayName=r.l9.displayName;let o=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)(r.UC,{ref:s,className:(0,n.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...l})});o.displayName=r.UC.displayName},6381:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>L});var a=t(5155),l=t(2115),r=t(5695),n=t(7168),c=t(8482),i=t(8145),d=t(4964),o=t(9051),m=t(3999);let u=l.forwardRef((e,s)=>{let{className:t,children:l,...r}=e;return(0,a.jsxs)(o.bL,{ref:s,className:(0,m.cn)("relative overflow-hidden",t),...r,children:[(0,a.jsx)(o.LM,{className:"h-full w-full rounded-[inherit]",children:l}),(0,a.jsx)(x,{}),(0,a.jsx)(o.OK,{})]})});u.displayName=o.bL.displayName;let x=l.forwardRef((e,s)=>{let{className:t,orientation:l="vertical",...r}=e;return(0,a.jsx)(o.VM,{ref:s,orientation:l,className:(0,m.cn)("flex touch-none select-none transition-colors","vertical"===l&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===l&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:(0,a.jsx)(o.lr,{className:"relative flex-1 rounded-full bg-border"})})});x.displayName=o.VM.displayName;var h=t(2178),j=t(5690),f=t(646),b=t(4861),p=t(2431),N=t(7550),v=t(3904),g=t(6618),w=t(4186),y=t(1684),k=t(5196),_=t(4357),A=t(7434),C=t(6453),E=t(2261),S=t(1380);function F(){var e,s;let t=(0,r.useParams)(),o=(0,r.useRouter)(),m=null==t?void 0:t.id,{t:x}=(0,E.s)(),{job:F,loading:R,error:L,isRunning:Z,refetch:B}=(0,C.JJ)(m),[J,M]=(0,l.useState)(!0),[O,$]=(0,l.useState)(null);(0,l.useEffect)(()=>{if(!m||!J)return;let e=setInterval(()=>{(null==F?void 0:F.status)==="running"&&B()},2e3);return()=>clearInterval(e)},[m,null==F?void 0:F.status,J,B]);let z=e=>new Date(e).toLocaleString("ja-JP",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),D=async(e,s)=>{try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(e);else{let s=document.createElement("textarea");s.value=e,document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)}$(s),setTimeout(()=>$(null),2e3)}catch(e){}};return R?(0,a.jsx)("div",{className:"min-h-screen bg-background flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),(0,a.jsx)("p",{children:"ジョブ詳細を読み込み中..."})]})}):L?(0,a.jsx)("div",{className:"min-h-screen bg-background flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsxs)("p",{className:"text-red-600 mb-4",children:["エラー: ",L]}),(0,a.jsx)(n.$,{onClick:()=>o.push("/"),children:"戻る"})]})}):F?(0,a.jsxs)("div",{className:"min-h-screen bg-background",children:[(0,a.jsx)(S.Y,{}),(0,a.jsxs)("div",{className:"container mx-auto max-w-7xl p-6 space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)(n.$,{variant:"outline",size:"sm",onClick:()=>o.push("/?tab=tasks"),children:[(0,a.jsx)(N.A,{className:"w-4 h-4 mr-2"}),x("common.back")]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold",children:x("job.title")}),(0,a.jsxs)("p",{className:"text-muted-foreground",children:["ジョブID: ",m]})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(e=>{let s={pending:{color:"bg-yellow-100 text-yellow-800",icon:h.A,label:"待機中"},running:{color:"bg-blue-100 text-blue-800",icon:j.A,label:"実行中"},completed:{color:"bg-green-100 text-green-800",icon:f.A,label:"完了"},failed:{color:"bg-red-100 text-red-800",icon:b.A,label:"失敗"},cancelled:{color:"bg-gray-100 text-gray-800",icon:p.A,label:"キャンセル"}}[e],t=s.icon;return(0,a.jsxs)(i.E,{className:s.color,children:[(0,a.jsx)(t,{className:"mr-1 h-3 w-3"}),s.label]})})(F.status),F.yolo_mode&&(0,a.jsx)(i.E,{variant:"outline",children:"YOLO Mode"}),Z&&(0,a.jsxs)(i.E,{variant:"outline",className:"text-blue-600",children:[(0,a.jsx)(j.A,{className:"mr-1 h-3 w-3"}),"実行中"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(n.$,{variant:"outline",size:"sm",onClick:B,disabled:R,children:[(0,a.jsx)(v.A,{className:"mr-1 h-4 w-4 ".concat(R?"animate-spin":"")}),"更新"]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox",checked:J,onChange:e=>M(e.target.checked),className:"rounded"}),"自動更新"]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)(c.Zp,{children:[(0,a.jsx)(c.aR,{className:"pb-3",children:(0,a.jsxs)(c.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(g.A,{className:"h-4 w-4"}),"プロジェクト情報"]})}),(0,a.jsxs)(c.Wu,{className:"space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm font-medium",children:null===(e=F.project)||void 0===e?void 0:e.name}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:null===(s=F.project)||void 0===s?void 0:s.path})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"実行ディレクトリ"}),(0,a.jsx)("div",{className:"text-sm font-mono",children:F.execution_directory})]})]})]}),(0,a.jsxs)(c.Zp,{children:[(0,a.jsx)(c.aR,{className:"pb-3",children:(0,a.jsxs)(c.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(w.A,{className:"h-4 w-4"}),"実行情報"]})}),(0,a.jsxs)(c.Wu,{className:"space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"作成日時"}),(0,a.jsx)("div",{className:"text-sm",children:z(F.created_at)})]}),F.started_at&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"開始日時"}),(0,a.jsx)("div",{className:"text-sm",children:z(F.started_at)})]}),F.completed_at&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"完了日時"}),(0,a.jsx)("div",{className:"text-sm",children:z(F.completed_at)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"実行時間"}),(0,a.jsx)("div",{className:"text-sm",children:((e,s)=>{if(!e)return"-";let t=new Date(e),a=Math.floor(((s?new Date(s):new Date).getTime()-t.getTime())/1e3);if(a<60)return"".concat(a,"秒");let l=Math.floor(a/60);if(l<60)return"".concat(l,"分").concat(a%60,"秒");let r=Math.floor(l/60);return"".concat(r,"時間").concat(l%60,"分")})(F.started_at,F.completed_at)})]}),F.pid&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"プロセスID"}),(0,a.jsx)("div",{className:"text-sm font-mono",children:F.pid})]}),void 0!==F.exit_code&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"終了コード"}),(0,a.jsx)("div",{className:"text-sm font-mono",children:F.exit_code})]})]})]})]}),(0,a.jsxs)(c.Zp,{children:[(0,a.jsx)(c.aR,{className:"pb-3",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(c.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(y.A,{className:"h-4 w-4"}),x("job.command")]}),(0,a.jsx)(n.$,{variant:"outline",size:"sm",onClick:()=>D(F.command,"command"),className:"h-6 w-6 p-0",children:"command"===O?(0,a.jsx)(k.A,{className:"w-3 h-3"}):(0,a.jsx)(_.A,{className:"w-3 h-3"})})]})}),(0,a.jsx)(c.Wu,{children:(0,a.jsx)("div",{className:"bg-gray-50 dark:bg-gray-900 p-3 rounded-md font-mono text-sm",children:F.command})})]}),(0,a.jsxs)(d.tU,{defaultValue:"output",className:"w-full",children:[(0,a.jsxs)(d.j7,{className:"grid w-full grid-cols-2",children:[(0,a.jsxs)(d.Xi,{value:"output",className:"flex items-center gap-2",children:[(0,a.jsx)(A.A,{className:"h-4 w-4"}),x("job.outputLog")]}),(0,a.jsxs)(d.Xi,{value:"error",className:"flex items-center gap-2",children:[(0,a.jsx)(b.A,{className:"h-4 w-4"}),x("job.errorLog")]})]}),(0,a.jsx)(d.av,{value:"output",className:"mt-4",children:(0,a.jsxs)(c.Zp,{children:[(0,a.jsx)(c.aR,{className:"pb-3",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(c.ZB,{className:"text-sm",children:"標準出力"}),F.output_log&&(0,a.jsx)(n.$,{variant:"outline",size:"sm",onClick:()=>D(F.output_log||"","output"),className:"h-6 w-6 p-0",children:"output"===O?(0,a.jsx)(k.A,{className:"w-3 h-3"}):(0,a.jsx)(_.A,{className:"w-3 h-3"})})]})}),(0,a.jsx)(c.Wu,{children:(0,a.jsx)(u,{className:"h-96 w-full rounded-md border",children:(0,a.jsx)("div",{className:"p-4",children:F.output_log?(0,a.jsx)("pre",{className:"text-sm font-mono whitespace-pre-wrap",children:F.output_log}):(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:x("job.noOutputLog")})})})})]})}),(0,a.jsx)(d.av,{value:"error",className:"mt-4",children:(0,a.jsxs)(c.Zp,{children:[(0,a.jsx)(c.aR,{className:"pb-3",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(c.ZB,{className:"text-sm",children:"標準エラー出力"}),F.error_log&&(0,a.jsx)(n.$,{variant:"outline",size:"sm",onClick:()=>D(F.error_log||"","error"),className:"h-6 w-6 p-0",children:"error"===O?(0,a.jsx)(k.A,{className:"w-3 h-3"}):(0,a.jsx)(_.A,{className:"w-3 h-3"})})]})}),(0,a.jsx)(c.Wu,{children:(0,a.jsx)(u,{className:"h-96 w-full rounded-md border",children:(0,a.jsx)("div",{className:"p-4",children:F.error_log?(0,a.jsx)("pre",{className:"text-sm font-mono whitespace-pre-wrap text-red-600",children:F.error_log}):(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:x("job.noErrorLog")})})})})]})})]})]})]}):(0,a.jsx)("div",{className:"min-h-screen bg-background flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"mb-4",children:"ジョブが見つかりません"}),(0,a.jsx)(n.$,{onClick:()=>o.push("/"),children:"戻る"})]})})}function R(){return(0,a.jsx)("div",{className:"min-h-screen bg-background flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),(0,a.jsx)("p",{children:"ジョブ詳細を読み込み中..."})]})})}function L(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(R,{}),children:(0,a.jsx)(F,{})})}},6453:(e,s,t)=>{"use strict";t.d(s,{JJ:()=>n,Os:()=>r,TI:()=>c,Wv:()=>i,YK:()=>d});var a=t(2115),l=t(1886);function r(e){let[s,t]=(0,a.useState)([]),[r,n]=(0,a.useState)(!0),[c,i]=(0,a.useState)(null),[d,o]=(0,a.useState)(0),m=(0,a.useCallback)(async()=>{try{n(!0),i(null);let s=await l.F.jobs.getAll(e);t(s.jobs),o(s.count)}catch(e){i(e instanceof Error?e.message:"Failed to fetch jobs"),t([]),o(0)}finally{n(!1)}},[e]);return(0,a.useEffect)(()=>{m()},[m]),{jobs:s,loading:r,error:c,count:d,refetch:m}}function n(e){let[s,t]=(0,a.useState)(null),[r,n]=(0,a.useState)(!0),[c,i]=(0,a.useState)(null),[d,o]=(0,a.useState)(!1),m=(0,a.useCallback)(async()=>{if(!e){t(null),n(!1);return}try{n(!0),i(null);let s=await l.F.jobs.getById(e);t(s.job),o(s.is_running)}catch(e){i(e instanceof Error?e.message:"Failed to fetch job"),t(null),o(!1)}finally{n(!1)}},[e]);return(0,a.useEffect)(()=>{m()},[m]),{job:s,loading:r,error:c,isRunning:d,refetch:m}}function c(){let[e,s]=(0,a.useState)(!1),[t,r]=(0,a.useState)(null);return{createJob:(0,a.useCallback)(async e=>{try{return s(!0),r(null),(await l.F.jobs.create(e)).job}catch(s){let e=s instanceof Error?s.message:"Failed to create job";throw r(e),Error(e)}finally{s(!1)}},[]),loading:e,error:t}}function i(){let[e,s]=(0,a.useState)(!1),[t,r]=(0,a.useState)(null);return{cancelJob:(0,a.useCallback)(async e=>{try{s(!0),r(null),await l.F.jobs.cancel(e)}catch(s){let e=s instanceof Error?s.message:"Failed to cancel job";throw r(e),Error(e)}finally{s(!1)}},[]),deleteJob:(0,a.useCallback)(async e=>{try{s(!0),r(null),await l.F.jobs.delete(e)}catch(s){let e=s instanceof Error?s.message:"Failed to delete job";throw r(e),Error(e)}finally{s(!1)}},[]),loading:e,error:t}}function d(){let[e,s]=(0,a.useState)([]),[t,r]=(0,a.useState)(!0),[n,c]=(0,a.useState)(null),i=(0,a.useCallback)(async()=>{try{r(!0),c(null);let e=await l.F.projects.getAll();s(e.projects)}catch(e){c(e instanceof Error?e.message:"Failed to fetch projects"),s([])}finally{r(!1)}},[]);return(0,a.useEffect)(()=>{i()},[i]),{projects:e,loading:t,error:n,refetch:i}}},8900:(e,s,t)=>{Promise.resolve().then(t.bind(t,6381))}},e=>{var s=s=>e(e.s=s);e.O(0,[205,433,334,972,999,441,684,358],()=>s(8900)),_N_E=e.O()}]);